//base
import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
//less
import './index.less'
import WhiteSpace from '../../../../components/taro-ui/white-space'
import { navigateTo } from '../../../../crossplatform/apiservice/navigate'
import pagejumplist from '../../../../configuration/pagejumplist.json'

class CompanyCard extends Component {
  componentWillMount() {
    //onLoad
  }

  componentDidMount() {
    //onready
  }

  componentWillUnmount() {
    //onUnload
  }

  componentWillReceiveProps(nextprops) {}

  delay(time = 0) {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve()
      }, time)
    })
  }

  goto = () => {
    const { zhichuUserIdB } = this.props
    if (zhichuUserIdB) {
      navigateTo({
        url: pagejumplist['my-company'].path
      })
    } else {
      this.props.onChangeRole()
    }
  }

  render() {
    const { companyName } = this.props
    return (
      <View className="CompanyCard_id06343" onClick={this.goto}>
        <View className="cp-wrap-out">
          <Image
            className="bg-image"
            src="https://imagesize.hrwork.com/sp/files/51105721-d738-4884-8e26-592489955c1d.png"
          />
          <View className="message-wrap">
            <View className="message-top">
              <View className="title">我的企业</View>
              <View className="name">
                <View className="cpname">{companyName || ''}</View>
                <Image
                  src="https://imagesize.hrwork.com/sp/files/8db9c17d-2da7-4a9e-a44c-98a32670fcc7.png"
                  className="imgicon"
                />
              </View>
            </View>
            <View className="message-btm">
              {/*<View className="title">企业完善度</View>*/}
              {/*<View className="progress"></View>*/}
              {/*<View className="unit">0%</View>*/}
            </View>
          </View>
        </View>
        <WhiteSpace />
      </View>
    )
  }
}

export default CompanyCard
